
<!DOCTYPE html>
<html>
<head>
	<meta HTTP-EQUIV="Content-Type" Content="text-html; charset=UTF-8">
	<title>匹兹堡睡眠质量指数PSQI 在线测试</title>

<style>
	#divAll {
		text-align:center;
		border:0px solid #000;
	}
	#divContent{
		margin:0 auto;
		text-align:left;
		width:760px;
		border:1px solid #999;
		padding:10px 5px;
	}
	#divContent span{
		line-height:30px;
	}
	div.title{
		font-size:25px;
		font-weight:bold;
		margin:0 auto;
		text-align:center;
		padding:20px 0;
	}
	hr,fieldset{
		border:1px solid #999;
	}
</style>
</head>

<body>
<div id="divAll">
	<div id="divContent">
	<div class="title">匹兹堡睡眠质量指数PSQI</div>
	<fieldset>
	<legend>说明</legend>
	指导语:下面一些问题是关于您最近一个月的睡眠状况，这仅仅与您的睡眠习惯有关.
	请选择或填写最符合您近一介月白天和晚上实际情况的选项,并尽可能地做精确回答。
	</fieldset>
	<form action="scl90.sub.asp" method="post" id="f1">
	<hr>
	<div>1.过去1个月你通常上床睡觉时间是？（请按24h制填写,如：22:00、00:30）</div>
	<div>
		<input type="text" name="Time" id = "text1"><br>
	</div>


	<hr>
	<div>2.过去1个月你每晚通常要多长时间（min）才能入睡？</div>
	<div>
		<input type="radio" name="rdoNovack_1" value="0" id="rdoNovack_1_1"><label for="rdoNovack_1_1">小于15min </label>
		<input type="radio" name="rdoNovack_1" value="1" id="rdoNovack_1_2"><label for="rdoNovack_1_2">16~30min</label>
		<input type="radio" name="rdoNovack_1" value="2" id="rdoNovack_1_3"><label for="rdoNovack_1_3">31~60min</label>
		<input type="radio" name="rdoNovack_1" value="3" id="rdoNovack_1_4"><label for="rdoNovack_1_4">大于60min</label>
	</div>


	<hr>
	<div>3.过去1个月你每天早上通常什么时候起床？（请按24h制填写，如：9:00、9:30）</div>
	<div>
		<input type="text" name="Time" id = "text2"><br>
	</div>


	<hr>
	<div>4.过去1个月你每晚实际睡眠的时间有多少？（如：6小时、6.5小时）</div>
	<div>
		<input type="text" name="Time" id = "text3"><br>
	</div>

	<hr>
	说明：过去1个月你是否因为以下问题而经常睡眠不好（以下5~13个问题前都显示此描述）
	<hr>

	<div>5.不能在30min内入睡</div>
	<div>
		<input type="radio" name="rdoNovack_2" value="0" id="rdoNovack_2_1"><label for="rdoNovack_2_1">过去1个月没有 </label>
		<input type="radio" name="rdoNovack_2" value="1" id="rdoNovack_2_2"><label for="rdoNovack_2_2">每周平均不足1个晚上</label>
		<input type="radio" name="rdoNovack_2" value="2" id="rdoNovack_2_3"><label for="rdoNovack_2_3">每周平均1~2个晚上</label>
		<input type="radio" name="rdoNovack_2" value="3" id="rdoNovack_2_4"><label for="rdoNovack_2_4">每周平均3个或者更多晚上</label>
	</div>


	<hr>
	<div>6.在晚上睡眠中醒来或者早醒</div>
	<div>
		<input type="radio" name="rdoNovack_3" value="0" id="rdoNovack_3_1"><label for="rdoNovack_3_1">过去1个月没有 </label>
		<input type="radio" name="rdoNovack_3" value="1" id="rdoNovack_3_2"><label for="rdoNovack_3_2">每周平均不足1个晚上</label>
		<input type="radio" name="rdoNovack_3" value="2" id="rdoNovack_3_3"><label for="rdoNovack_3_3">每周平均1~2个晚上</label>
		<input type="radio" name="rdoNovack_3" value="3" id="rdoNovack_3_4"><label for="rdoNovack_3_4">每周平均3个或者更多晚上</label>
	</div>


	<hr>
	<div>7.每晚有无起床上洗手间</div>
	<div>
		<input type="radio" name="rdoNovack_4" value="0" id="rdoNovack_4_1"><label for="rdoNovack_4_1">过去1个月没有</label>
		<input type="radio" name="rdoNovack_4" value="1" id="rdoNovack_4_2"><label for="rdoNovack_4_2">每周平均不足1个晚上</label>
		<input type="radio" name="rdoNovack_4" value="2" id="rdoNovack_4_3"><label for="rdoNovack_4_3">每周平均1~2个晚上</label>
		<input type="radio" name="rdoNovack_4" value="3" id="rdoNovack_4_4"><label for="rdoNovack_4_4">每周平均3个或者更多晚上</label>
	</div>


	<hr>
	<div>8.不舒服的呼吸</div>
	<div>
		<input type="radio" name="rdoNovack_5" value="0" id="rdoNovack_5_1"><label for="rdoNovack_5_1">过去1个月没有 </label>
		<input type="radio" name="rdoNovack_5" value="1" id="rdoNovack_5_2"><label for="rdoNovack_5_2">每周平均不足1个晚上</label>
		<input type="radio" name="rdoNovack_5" value="2" id="rdoNovack_5_3"><label for="rdoNovack_5_3">每周平均1~2个晚上</label>
		<input type="radio" name="rdoNovack_5" value="3" id="rdoNovack_5_4"><label for="rdoNovack_5_4">每周平均3个或者更多晚上</label>
	</div>


	<hr>
	<div>9.大声咳嗽或者打鼾</div>
	<div>
		<input type="radio" name="rdoNovack_6" value="0" id="rdoNovack_6_1"><label for="rdoNovack_6_1">过去1个月没有 </label>
		<input type="radio" name="rdoNovack_6" value="1" id="rdoNovack_6_2"><label for="rdoNovack_6_2">每周平均不足1个晚上</label>
		<input type="radio" name="rdoNovack_6" value="2" id="rdoNovack_6_3"><label for="rdoNovack_6_3">每周平均1~2个晚上</label>
		<input type="radio" name="rdoNovack_6" value="3" id="rdoNovack_6_4"><label for="rdoNovack_6_4">每周平均3个或者更多晚上</label>
	</div>


	<hr>
	<div>10.感到寒冷</div>
	<div>
		<input type="radio" name="rdoNovack_7" value="0" id="rdoNovack_7_1"><label for="rdoNovack_7_1">过去1个月没有 </label>
		<input type="radio" name="rdoNovack_7" value="1" id="rdoNovack_7_2"><label for="rdoNovack_7_2">每周平均不足1个晚上</label>
		<input type="radio" name="rdoNovack_7" value="2" id="rdoNovack_7_3"><label for="rdoNovack_7_3">每周平均1~2个晚上</label>
		<input type="radio" name="rdoNovack_7" value="3" id="rdoNovack_7_4"><label for="rdoNovack_7_4">每周平均3个或者更多晚上</label>
	</div>


	<hr>
	<div>11.感到太热</div>
	<div>
		<input type="radio" name="rdoNovack_8" value="0" id="rdoNovack_8_1"><label for="rdoNovack_8_1">过去1个月没有 </label>
		<input type="radio" name="rdoNovack_8" value="1" id="rdoNovack_8_2"><label for="rdoNovack_8_2">每周平均不足1个晚上</label>
		<input type="radio" name="rdoNovack_8" value="2" id="rdoNovack_8_3"><label for="rdoNovack_8_3">每周平均1~2个晚上</label>
		<input type="radio" name="rdoNovack_8" value="3" id="rdoNovack_8_4"><label for="rdoNovack_8_4">每周平均3个或者更多晚上</label>
	</div>


	<hr>
	<div>12.做噩梦</div>
	<div>
		<input type="radio" name="rdoNovack_9" value="0" id="rdoNovack_9_1"><label for="rdoNovack_9_1">过去1个月没有 </label>
		<input type="radio" name="rdoNovack_9" value="1" id="rdoNovack_9_2"><label for="rdoNovack_9_2">每周平均不足1个晚上</label>
		<input type="radio" name="rdoNovack_9" value="2" id="rdoNovack_9_3"><label for="rdoNovack_9_3">每周平均1~2个晚上</label>
		<input type="radio" name="rdoNovack_9" value="3" id="rdoNovack_9_4"><label for="rdoNovack_9_4">每周平均3个或者更多晚上</label>
	</div>


	<hr>
	<div>13.出现疼痛</div>
	<div>
		<input type="radio" name="rdoNovack_10" value="0" id="rdoNovack_10_1"><label for="rdoNovack_10_1">过去1个月没有 </label>
		<input type="radio" name="rdoNovack_10" value="1" id="rdoNovack_10_2"><label for="rdoNovack_10_2">每周平均不足1个晚上</label>
		<input type="radio" name="rdoNovack_10" value="2" id="rdoNovack_10_3"><label for="rdoNovack_10_3">每周平均1~2个晚上</label>
		<input type="radio" name="rdoNovack_10" value="3" id="rdoNovack_10_4"><label for="rdoNovack_10_4">每周平均3个或者更多晚上</label>
	</div>


	<hr>
	<div>14.其他影响睡眠的事情 </div>
	<div>
		<input type="radio" name="rdoNovack_11" value="0" id="rdoNovack_11_1"><label for="rdoNovack_11_1">过去1个月没有 </label>
		<input type="radio" name="rdoNovack_11" value="1" id="rdoNovack_11_2"><label for="rdoNovack_11_2">每周平均不足1个晚上</label>
		<input type="radio" name="rdoNovack_11" value="2" id="rdoNovack_11_3"><label for="rdoNovack_11_3">每周平均1~2个晚上</label>
		<input type="radio" name="rdoNovack_11" value="3" id="rdoNovack_11_4"><label for="rdoNovack_11_4">每周平均3个或者更多晚上</label>
	</div>


	<hr>
	<div>15.你对过去1个月总睡眠质量评分</div>
	<div>
		<input type="radio" name="rdoNovack_12" value="0" id="rdoNovack_12_1"><label for="rdoNovack_12_1">非常好 </label>
		<input type="radio" name="rdoNovack_12" value="1" id="rdoNovack_12_2"><label for="rdoNovack_12_2">尚好</label>
		<input type="radio" name="rdoNovack_12" value="2" id="rdoNovack_12_3"><label for="rdoNovack_12_3">不好</label>
		<input type="radio" name="rdoNovack_12" value="3" id="rdoNovack_12_4"><label for="rdoNovack_12_4">非常差</label>
	</div>


	<hr>
	<div>16.近一个月您用催眠药物的情况</div>
	<div>
		<input type="radio" name="rdoNovack_13" value="0" id="rdoNovack_13_1"><label for="rdoNovack_13_1">过去1个月没有 </label>
		<input type="radio" name="rdoNovack_13" value="1" id="rdoNovack_13_2"><label for="rdoNovack_13_2">每周平均不足1个晚上</label>
		<input type="radio" name="rdoNovack_13" value="2" id="rdoNovack_13_3"><label for="rdoNovack_13_3">每周平均1~2个晚上</label>
		<input type="radio" name="rdoNovack_13" value="3" id="rdoNovack_13_4"><label for="rdoNovack_13_4">每周平均3个或者更多晚上</label>
	</div>


	<hr>
	<div>17.近一个月，您常感到困倦吗？</div>
	<div>
		<input type="radio" name="rdoNovack_14" value="0" id="rdoNovack_14_1"><label for="rdoNovack_14_1">过去1个月没有 </label>
		<input type="radio" name="rdoNovack_14" value="1" id="rdoNovack_14_2"><label for="rdoNovack_14_2">每周平均不足1个晚上</label>
		<input type="radio" name="rdoNovack_14" value="2" id="rdoNovack_14_3"><label for="rdoNovack_14_3">每周平均1~2个晚上</label>
		<input type="radio" name="rdoNovack_14" value="3" id="rdoNovack_14_4"><label for="rdoNovack_14_4">每周平均3个或者更多晚上</label>
	</div>


	<hr>
	<div>18.近一个月，您做事情的精力不足吗？</div>
	<div>
		<input type="radio" name="rdoNovack_15" value="0" id="rdoNovack_15_1"><label for="rdoNovack_15_1">没有 </label>
		<input type="radio" name="rdoNovack_15" value="1" id="rdoNovack_15_2"><label for="rdoNovack_15_2">偶尔有</label>
		<input type="radio" name="rdoNovack_15" value="2" id="rdoNovack_15_3"><label for="rdoNovack_15_3">有时有</label>
		<input type="radio" name="rdoNovack_15" value="3" id="rdoNovack_15_4"><label for="rdoNovack_15_4">经常</label>
	</div>


	<hr>
	<div style="text-align:center;"><input type="button" value="提交" onclick="javascript:pageSubmit();" id="cmdSub1"></div>
	</form>
	</div>
</div>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-2378316365182080" crossorigin="anonymous"></script><!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-GGBTVRJKD5"></script>
<script src="./dist/js/tabler.min.js"></script>
<script src="./dist/js/theme.min.js"></script>
<script src="./dist/js/jquery-3.6.3.min.js"></script>
<script src="./dist/js/jquery.toast.js"></script>
<script src="./js/common.js"></script>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-2378316365182080" crossorigin="anonymous"></script><!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-GGBTVRJKD5"></script>
<script>
	/*
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'G-GGBTVRJKD5');
  */

  function getRadioValue(name){
		let oR=$("input[name='"+name+"']");
		for(let j = 0; j < oR.length; j++)
			if(oR[j].checked)
				return oR[j].value;
		return undefined;
		}
	function pageSubmit(){
		let textEl1 = $('#text1').val();
		let textEl2 = $('#text2').val();
		let textEl3 = $('#text3').val();

		console.log(textEl1);
		console.log(textEl2);
		console.log(textEl3);
		//输入框数据检查
		if(!$('#text1').val()) {
			alert("请回答所有的问题后再提交。\n\n第 "+ 1 +" 个问题尚未回答。");
			return false;
		}
		if(!$('#text2').val()) {
			alert("请回答所有的问题后再提交。\n\n第 "+ 2 +" 个问题尚未回答。");
			return false;
		}
		if(!$('#text3').val()) {
			alert("请回答所有的问题后再提交。\n\n第 "+ 3 +" 个问题尚未回答。");
			return false;
		}
		
		
		let hobbys = []; //保存数据
		for(let i = 1; i < 16; i++){
			let radioValue = getRadioValue("rdoNovack_"+i);
			if(!radioValue){
				if(i == 1) {
					let j = i + 1;
					alert("请回答所有的问题后再提交。\n\n第 "+ j +" 个问题尚未回答。");
				} else {
					let k = i + 3;
					alert("请回答所有的问题后再提交。\n\n第 "+ k +" 个问题尚未回答。");
				}
				
				return 0;
			} 
			hobbys[i] = radioValue;
		}

		//将输入框元素加入到数组中
		hobbys[16] = textEl1;
		hobbys[17] = textEl2;
		hobbys[18] = textEl3;

		console.log("查看 hobbys");
		console.log(hobbys);


		$.ajax({
			type : 'get',
			url : 'sleep/create',
			dataType: 'json',
			data : {
				data :hobbys
			},
			success : function(respDate) {
				if(respDate.code == 0) {
					console.log('查看是否跳转');
					location.assign('/sleep-result.html');

				} else {
					$.toast({
                      heading: '警告',
                      text: respDate.message,
                      icon: 'warning' 
					});
				}

			},
			error : function() {
				$.toast({
                  heading: '错误',
                  text: '服务器错误，请联系管理员',
                  icon: 'error' 
				 });
				}
			})	
	}
</script>

</body>
</html>
